1) Field of the Invention
The present invention relates to a deblocking filter which reduces block distortion, and also relates to an image encoder and an image decoder which use such a deblocking filter.
2) Description of the Related Art
Currently, the MPEG (Moving Picture Expert Group) standards, the ITU-T H.264 standard, and the like are known as technical standards specifying techniques for compression encoding of a video signal. According to the MPEG or H.264 standards, the size of the basic macroblock is 16×16 pixels. In addition, according to the H.264 standard, the blocks with the size of 4×4 pixels can also be used when necessary. In particular, according to the H.264 standard, a deblocking filter is used for eliminating blocking distortion from images and improving the image quality at a low bit rate.
The general deblocking filters perform edge-filtering for changing the values of four pixels located on the current-macroblock side of the boundary (edge) and four pixels located on the adjacent-macroblock side of the boundary on the basis of the filtering strength and the pixels on the current-macroblock side and the adjacent-macroblock side. The change in the values of the pixels increases the correlation between the pixels adjacent to each other, so that the blocking distortion is apparently reduced. The edge-filtering includes vertical-edge filtering and horizontal-edge filtering. In the vertical-edge filtering, filtering is performed on an edge oriented in the vertical (column) direction. In the horizontal-edge filtering, filtering is performed on an edge oriented in the horizontal (row) direction. The vertical edge is an edge oriented in the column direction, and the horizontal edge is an edge oriented in the row direction. The deblocking filters first perform vertical-edge-filtering operations, and then horizontal-edge-filtering operations. During each edge-filtering operation, pixel values determined by a preceding edge-filtering operation are used, for example, as indicated in Japanese Unexamined Patent Publication No. 2005-535198 (corresponding to International Patent Publication WO2004/014082).
FIG. 36 is a diagram illustrating a vertical-edge-filtering operation of a conventional deblocking filter. In FIG. 36, the rows in the array of pixels are respectively labelled as A to T, and the columns in the array of pixels are respectively labelled as 0 to 19. Therefore, for example, the pixel in row 1 column 0 is referred to as the pixel A0, and the pixel in row 20 column 20 is referred to as the pixel T19. In addition, “Clock” denotes the clock signal used for operation of the deblocking filter, “Current” denotes the four pixels on the current-macroblock side, “Adjacent” denotes the four pixels on the adjacent-macroblock side, “Write” denotes the pixels stored in a memory, and reference number 91 denotes the current macroblock, which has the size of 16×16 pixels.
In the conventional vertical-edge filtering, an operation of filtering the edge between the pixels E3 and E4 is performed in a clock cycle by using the group of four pixels E0 to E3 (as four adjacent-side pixels) and the group of four pixels E4 to E7 in the macroblock 91 (as four current-side pixels), and then an operation of filtering the edge between the pixels E7 and E8 is performed in the next clock cycle by using the group of four filtered pixels E4 to E7 in the macroblock (as four adjacent-side pixels) and the group of four pixels E8 to E11 in the macroblock (as four current-side pixels). Thereafter, similar operations are performed in the subsequent clock cycles.
As described above, a first group of four pixels arranged in a row and processed as the four current-side pixels in a first edge-filtering operation are thereafter used as the four adjacent-side pixels in a second edge-filtering operation in which a second group of four pixels arranged adjacent to the first group of four pixels in the row direction are processed. Therefore, if a group of four filtered pixels are stored as they are in the memory, the stored pixels are required to be read out from the memory for the next edge-filtering operation, so that the operation is not efficient. In order to solve this problem, conventionally, a group of four filtered pixels is once held in a register or the like from which data can be relatively easily read out, and is thereafter reused in the filtering of the adjacent edge in the forward direction. Specifically, each group of pixels as the four current-side pixels is read out from a memory circuit, and are then filtered on the basis of relationships with adjacent-side pixels and the filtering strength which are prepared or set in advance, where each group of pixels is stored in the memory circuit in succession in the row direction after the group of pixels are filtered.
FIG. 37 is a diagram illustrating a horizontal-edge-filtering operation of a conventional deblocking filter. In the conventional horizontal-edge filtering, a group of four pixels to be processed in a horizontal-edge-filtering operation are prepared in every four clock cycles, and an operation of filtering an edge between another group of four pixels which are already horizontal-edge filtered and the above group of four pixels prepared to be processed, where the group of four horizontal-edge-filtered pixels are handled as four adjacent-side pixels (as indicated by the references A4 to D4 in FIG. 37), and the group of four pixels prepared to be processed are handled as four current-side pixels (as indicated by the references E4 to H4 in FIG. 37). Thereafter, similar operations are performed.
However, since the vertically-filtered data are stored in the memory circuit in the horizontal (row) direction in the conventional horizontal-edge filtering, it is impossible to perform the horizontal-edge filtering until the operation of reading out the data of necessary pixels (the current-side pixels) are completed, so that the necessary processing time increases. Therefore, shortage of the processing time occurs in particular in image processing for display in a large screen.